﻿using GraphTast.DataModels;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GraphTast.Data
{
    public static class Seeder
    {
        public static void Seed(ApplicationDbContext context)
        {
            var user = new ApplicationUser()
            {
                UserName = "user01",
                Email = "user01@mail.com"
            };
            var user02 = new ApplicationUser()
            {
                UserName = "user02",
                Email = "user02@mail.com"
            };

            UserManager<ApplicationUser> um = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(context));

            var checkUser = um.FindByName(user.UserName);
            if (checkUser == null)
            {
                um.Create(user, "pass01");
                context.SaveChanges();
            }
            var checkUser02 = um.FindByName(user02.UserName);
            if (checkUser02 == null)
            {
                um.Create(user02, "pass01");
                context.SaveChanges();
            }
        }
    }
}
